<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="${pageContext.request.contextPath}/editor/jquery/jquery-1.4.4.min.js"></script>
<body>
<jsp:include page="../user/top.jsp"></jsp:include>
<jsp:include page="../user/left.jsp"></jsp:include>
<div style="position:absolute;left:200px;top:50px;">
  <form class="dan_form" id="importForm" action="Import" method="post" enctype="multipart/form-data">
 				<p><label>下载导入暂存单样式：</label><input type="button" value="下载" onclick="downLoad()" class="z_an"/></p><br/><br/>
 				<div class="clear"></div>
 				<div style="width:750px;border-bottom:2px solid #AAAAAA;margin:20px auto"></div>
 				
            	<input type="hidden" id="fileName" name="fileName"/>
            	<!-- <input type="hidden" id="fileMsg" name="fileMsg" value="${fileMsg }"/> -->
            	<p><label>选择Excel文件：</label><input type="file" id="file" name="file"/></p><br/><br/><br/>
            	<p><label></label><input type="button" id="impor" value="导入" class="z_an" style="margin-left: 144px;" onclick="importFile()"/>
            		<span id="message" style="color: red;">${fileMsg }</span></p>
            	<span id="message" style="color: green;">注意：在导入过程中，为了避免出现不必要的错误，您的Excel文件所有单元格格式最好是“文本”的格式。</span>
  </form>
</div>
</body>
<script type="text/javascript">
	function importFile(){
		var filePath = $("#file").val();
		var fileName = filePath.substr(filePath.lastIndexOf("\\")+1);
		//var fileType = fileName.substr(fileName.lastIndexOf(".")+1).toLowerCase();
		if(filePath==""){
			alert("请选择导入的文件");
		}else{
			$("#impor").attr("disabled", "disabled");
			$("#fileName").val(fileName);
			importForm.action="${pageContext.request.contextPath}/Import.action";
			importForm.submit();
		}
	}

	function downLoad(){
		window.location.href = "${pageContext.request.contextPath}/downExcel.action";
	}

	//$(function(){
	//	if($("#fileMsg").val() != ""){
	//		alert($("#fileMsg").val());
	//	}
	//});
</script>
</html>